package com.lnsoft.dqfs.server.handle.codec;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import lombok.Data;

@Data
public class Frame {

    /**
     * 当前主动下发步骤
     */
    private volatile int process = 0;
    /**
     *  终端是否已完成初始化连接
     */
    private volatile boolean connectFlag = false;

    /**
     *  是否需要反转server端的fcb
     */
    private volatile boolean upServerFcb = false;


    private int readTimeOutNumber = 0;


    /**
     * 数据库对应终端主键ID
     */
    private volatile String clientId;


    private volatile int upgradePackageindex;

    /**
     *  server端Fcb
     */
    private volatile byte serverFcb = 0;

    /**
     *  客户端Fcb
     */
    private volatile byte clientFcb = 0;

    /**
     *  对应的是终端编号(0-65536)
     */
    private int clientName;

    private byte a1;
    private byte a2;

    /**
     *  服务端端口号
     */
    private int serverPort;

    private ByteBuf byteBuf = Unpooled.directBuffer(); // 堆外内存

    private volatile String argId; // 参数表Id

    //  留存主站主发完的报文，用于重发
    private byte[] sendingFrame = null;

    //  终端上传数据是否完成的标志
    private boolean finished = false;

    //  升级之前终端的版本号
    private String oldVersion = null;

    //  数据库中对应的升级记录ID,便于更新记录信息
    private String recordId = null;

}
